<form class="form-horizontal" id="add_form" action="" method="post">
    {% csrf_token %}
    <div class="box-body">
        {% for field in form_obj %}
            <div class="form-group{% if field.errors %} has-error{% endif %}">
                <label class="col-sm-2 control-label">{{ field.label }}
                    {% if field.field.required %}
                        <span class="text-red">*</span>
                    {% endif %}
                </label>
                <div class="col-sm-9">
                    {{ field }}
                </div>
                <span class="help-block">
                  {% for error in field.errors %}
                      {{ error }}
                  {% endfor %}
                    {{ field.help_text }}
                </span>
            </div>
        {% endfor %}
        <div class="box-footer text-center">
            <button type="reset" class="btn btn-warning">清空</button>
            <button id="createBtn" type="button" class="btn save-btn">提交</button>
            <p class="text-center"><i id='iconWait'></i></p>
        </div>
    </div>
</form>
{% block js %}
    <script>
        $(".save-btn").on("click", function () {
            url = "{% url 'initLogAdd' %}"
            Net.post({
                url: url,
                data: $("#add_form").serialize(),
                go: {% url 'initList' %},
            })
        })
    </script>
{% endblock %}